package com.todo.biz.application.entity.enums;

import com.todo.biz.application.handler.review.content.SensitiveWordsHandle;
import com.todo.biz.application.handler.review.content.TripartiteReviewHandle;
import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Arrays;
import java.util.Map;
import java.util.stream.Collectors;

/**
 * @author azhebuxing
 * @date 2024/6/12 14:24
 * @description
 */
@Getter
@AllArgsConstructor
public enum ContentReviewEnum {

    SENSITIVE_WORDS("sensitiveWordsHandle", SensitiveWordsHandle.class, "敏感词过滤"),
    TRIPARTITE_REVIEW("tripartiteReviewHandle", TripartiteReviewHandle.class, "三方审查"),

    ;

    private static Map<String, ContentReviewEnum> enumMap = Arrays.stream(ContentReviewEnum.values()).collect(Collectors.toMap(ContentReviewEnum::getCode, e -> e));

    private String code;
    /**
     * 场景code
     */
    private Class clazz;
    /**
     * 场景描述
     */
    private String desc;


    public static ContentReviewEnum getContentReviewEnumByCode(String code) {
        if (code == null) {
            return null;
        }
        return enumMap.get(code);
    }

    public static String getClazz(String code) {
        if (code == null) {
            return null;
        }
        return getContentReviewEnumByCode(code) == null ? null : getContentReviewEnumByCode(code).getCode();
    }
}
